package com.lijian.mapper;

import com.lijian.model.SysRoleUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoleUserMapper {

    @Insert("insert into sys_role_user(userId, roleId) values(#{userId}, #{roleId})")
    void save(SysRoleUser sysRoleUser);

    @Select("select * from sys_role_user where userId = #{userId}")
    SysRoleUser findRoleUserByUserId(Integer userId);

    void update(SysRoleUser sysRoleUser);

    @Delete("delete from sys_role_user where userId = #{id}")
    void deleteByUserId(Integer id);

    @Select("select * from sys_role_user t where t.roleId = #{roleId}")
    List<SysRoleUser> findAllSysRoleUserByRoleId(Integer roleId);
}
